<%@page import="java.util.Iterator"%>
<%@page import="org.gpf.factory.DAOFactory"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html; charset=utf-8"%>
<%
	String keyword = request.getParameter("kw");
	if(keyword == null){
		keyword = ""; // 如果没有查询关键字则查询全部
	}
	List users = DAOFactory.getIUserDAOInstance().findAll(keyword);
	pageContext.setAttribute("users", users);
	//Iterator iterator = users.iterator();
%>
<center>
<h1>雇员信息如下</h1>
<form action="user_list.jsp" method="post">
	请输入查询关键字:<input type="text" name = "kw">
	<input type="submit" value="查询">
</form>
<table border="1">
  <tr>
    <th>雇员编号</th>
    <th>雇员姓名</th>
    <th>雇员密码</th>
    <th>雇员性别</th>
    <th>雇佣年龄</th>
    <th>雇员生日</th>
  </tr>
<%--
	while(iterator.hasNext()){
		pageContext.setAttribute("user", iterator.next());
--%>
<!-- 
	<tr>
	    <td>${user.id }</td>
	    <td>${user.username}</td>
	    <td>${user.password}</td>
	    <td>${user.sex}</td>
	    <td>${user.age}</td>
	    <td>${user.birthday}</td>
  	</tr>
--> 
	<%@taglib prefix="c" uri="http://127.0.0.1/JavaUserAdmin/jstl/core"%>
	<c:forEach items="${users }" var="user">
		<tr>
		    <td>${user.id }</td>
		    <td>${user.username}</td>
		    <td>${user.password}</td>
		    <td>${user.sex}</td>
		    <td>${user.age}</td>
		    <td>${user.birthday}</td>
  		</tr>
	</c:forEach>
<%--	
	}
--%>

</table>
</center>